## Build
# This dockerfile uses the linux image
# VERSION 1.2.0
# Author: lianghang
# Command format: Instruction [arguments / command] …

FROM golang:latest AS builder

LABEL db2s="db2s"
MAINTAINER  lianghang <ywlianghang@163.com>

ENV GO111MODULE=on \
    GOOS=linux \
    GOPROXY="https://goproxy.io" \
    GOPRIVATE="github.com/marvinhosea/*"

WORKDIR /go/release

COPY  . .

ARG VERSION

RUN go mod tidy
RUN go build -o db2s greatdbCheck.go
RUN mkdir -p ./db2s-${VERSION} && cp -rf docs gc.conf gc.conf-simple db2s Oracle/instantclient_11_2 README.md relnotes db2s-${VERSION}

FROM scratch AS exporter

ARG VERSION

COPY --from=builder /go/release/db2s-${VERSION} ./db2s-${VERSION}

# DOCKER_BUILDKIT=1 docker build --build-arg VERSION=v1.2.0 -f Dockerfile -o ./ .
